/*
 * @Description:
 * @Autor: 刘诗文
 * @Date: 2021-01-25 14:42:50
 * @LastEditors: 刘诗文
 * @LastEditTime: 2021-02-03 19:54:30
 */
import axios from '@/api/fetch';
import SERVER from '@/api/server';

// 查询维修业务
export const queryRepairBusiness = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/business/findAll`, {
    params
  });

// 获取FD信息
export const getfd = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/business/getfd`, {
    params
  });

// 生成索赔单号
export const queryClaimNo = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/business/repairOrder/claimNo`, {
    params
  });

// 品牌 - 下拉框
export const getPinpSelect = params =>
  axios.get(`/api/basedata/vehicleProduct/brandsqueryall`, {
    params
  });

// 车系 - 下拉框
export const getChexSelect = (id, params) =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/baseData/repair/${id}/seriesSelect`, {
    params
  });

// 车型 - 下拉框
export const modelsDict = (brand, series) => axios.get(`${SERVER.DMSCLOUD_REPAIR}/baseData/repair/${brand}/${series}/modelSelect`, {});

// 收费区分
export const queryChargeDifferentiationList = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/chargeDifferentiationList`, {
    params
  });

// 工单查询明细
export const queryDetailed = roNo => axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/business/account/${roNo}`, {});

// 维修项目查询
export const queryRepairLabour = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/business/queryRepairLabour`, { params });

// 维修材料查询
export const queryRepairPart = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/business/queryRepairPart`, { params });

// 预估备件
export const queryRepairPartYg = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/business/queryRepairPartYg`, { params });

// 销售材料查询
export const querySellMaterial = roNo => axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/business/SellMaterial/${roNo}`, {});

// 附加项目查询
export const addItem = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/business/addItem`, { params });

// 结算单收费对象信息查询
export const queryPayObj = roNo => axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/business/queryPayObj/${roNo}`, {});

// 工单解锁
export const unLockRepairOrder = roNo => axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/business/unLockRepairOrder/${roNo}`, {});

// 查看日志
export const queryLog = roNo => axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/business/queryOperationLog/${roNo}`, {});

// 维修业务查询导出
export const repairBussinessExportExcel = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/business/export/excel`, {
    params,
    responseType: 'arraybuffer'
  });

// 结算单信息查询
export const queryBlalanceInfo = roNo => axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/business/queryBalanceInfo/${roNo}`, {});

// 打印试车记录公共方法
export const tryPrint = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/try/print`, { params });

// 导出权限
export const menuUserAction = params => axios.get(`${SERVER.WXDMSCLOUD_BASEDATA}/menu/menuUserAction`, { params });

// 查询备件明细新建接口
export const queryRepairPartCopy = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/business/queryRepairPartTotal`, { params });

// 查询维修明细新建接口
export const queryRepairLabourCopy = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/business/queryRepairLabourTotal`, { params });

// 维修业务查询导出
export const repairBusinessExport = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/business/repairBusinessExport`, { params, responseType: 'blob' }); // timeout: 600000 设置为10分钟 7万条数据 返回157MB时后端服务内存溢出崩溃 故去除
